<?php

	class Navbar 
	{
		public $Menu1=array();
		public $Menu2=array();
		public $link1=array();
		public $link2=array();
		public $id1=array();
		public $id2=array();
		public $kanan;
		public $kiri;
		public $img;
		public $hrf_img;
		public function run()
		{

			echo '<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
					<div class="container-fluid">
						<div class="container">
							<div class="navbar-header">
								<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#hilang">
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
									<span class="icon-bar"></span>
								</button>
								<a class="navbar-brand" href="'.$this->hrf_img.'">
									<img alt="Brand" src="'.$this->img.'" style="width:50px;height:50px"> TetraSMA E-Learning
								</a>
							</div>
							<div class="collapse navbar-collapse" id="hilang">

							<ul class="nav navbar navbar-nav" style="margin-top:10px;font-size:18px;">';
							

									foreach ($this->Menu1 as $index=> $menu) 
									{
										if($this->kanan==1)
										{
										echo '<li><a href="pg/'.$menu.'.php">'.$menu.'</a></li>';
										}
										if($this->kanan==2)
										{
										echo '<li style="20px"><a href="'.$this->link1[$index].'" id="'.$this->id1[$index].'">'.$menu.'</a></li>';
										}	
									}
									if(isset($_SESSION['username']))
										 {   
										   echo '<li tyle="20px"><form class="navbar-form" role="search" action="search.php">
									        <div class="form-group">
									          <input type="text" class="form-control" placeholder="Search" name="judul">
									        </div>
									        <button type="submit" class="btn btn-default">Submit</button>
									      </form></li>';
										 }
									
									echo '</ul>';
										
										


							echo	'<ul class="nav navbar navbar-nav navbar-right " style="margin-top:10px;font-size:18px;" >';

								foreach ($this->Menu2 as $index=> $menu2) 
									{
										if($this->kiri==1)
										{
										echo '<li tyle="20px"><a href="pg/'.$menu2.'.php">'.$menu2.'</a></li>';
										}
										if($this->kiri==2)
										{
										echo '<li tyle="20px"><a data-toggle="modal" href="'.$this->link2[$index].'" id="'.$this->id2[$index].'">'.$menu2.'</a></li>';
										}	
									}
							echo'</ul>';
							
							echo '</div>
						</div>
					</div>
				</nav>
				';
		}
	}
?>